<?php
namespace app\index\logic;
use app\common\model\Base;

class CaipaiList extends Base
{
    //购彩大厅彩种分类列表
    static function getMallLotteryList() {
        $res = CaipaiList::name('caipai_list')->where('cp_if_open',1)->order('cp_dn_px','DESC')->select()->toArray();
        foreach($res as $rmcount=>&$cpl) {
            if($cpl['cp_name_new'] == '') {
                $cpl['cp_name_new'] = $cpl['cp_name_old'];
            }
            if($cpl['cp_dn_index'] == 1) {
                $tuijian_url[] = $cpl;
            }
            if(in_array($cpl['id'],config('lottery_class.ssc'))) {
                $shishicai[] = $cpl;
            }
            if(in_array($cpl['id'],config('lottery_class.ks'))) {
                $kusisan_url[] = $cpl;
            }
            if(in_array($cpl['id'],config('lottery_class.syxw'))) {
                $shiyixuanwu[] = $cpl;
            }
            if(in_array($cpl['id'],config('lottery_class.high'))) {
                $qita_url1[] = $cpl;
            }
            if(in_array($cpl['id'],config('lottery_class.low'))) {
                $dipin_url1[] = $cpl;
            }
        }
        return array('tuijian_url'=>$tuijian_url,'shishicai'=>$shishicai,'kusisan_url'=>$kusisan_url,'shiyixuanwu'=>$shiyixuanwu,'qita_url1'=>$qita_url1,'dipin_url1'=>$dipin_url1);
    }
    
    //购彩大厅所有彩种信息
    public function getMallLotteryDetail() {
        $res = model('CaipaiList')->getLotteryDetailOfMall();
        foreach($res as $rmcount=>&$cpl) {
            if($cpl['cp_name_new'] == '') {
                $cpl['cp_name_new'] = $cpl['cp_name_old'];
            }
            //开奖结果转换为彩色号码球
            $cpl['kjjg_dating'] = kjjg_split($cpl['kjjg'],$cpl['id']);
        }
        return $res;
    }
    
}